<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue指令2</title>
    <script src="../script/vue.js"></script>
</head>
<body>
    <!-- v-bind v-on v-model v-if v-else-if v-else v-for v-show -->
    <div id="app">
        <!-- v-if -->
        <input type="text" name="" id="" v-model="age">
        <p v-if="age<=20">{{w1}}</p>
        <p v-else-if="age<40&&age>20">{{w2}}</p>
        <p v-else>{{w3}}</p>

        <!-- v-show -->
        <p v-show="age<50">{{w4}}</p>

        <!-- v-for两种方式 -->
        <p v-for="add in addr">{{add}}</p>
        <p v-for="(add,index) in addr">{{index+1}}:{{add}}</p>

    </div>
</body>
<script> 
    // v-if不成立彻底不渲染
    // v-show不成立仅改变display为null
    new Vue({
        el:"#app",
        data:{
            age:20,
            w1:"年轻人",
            w2:"中年人",
            w3:"老年人",
            w4:"test",
            addr:["11","22","33","44","55","66"],
        }
    })
</script>
</html>